import {requestApi, requestRaw} from '../util/network'


// 城市列表
export const getTravelcity =
    (data, keyword) =>
        requestApi(
            '/Travelcity/city_lists',
            'POST',
            {
                'keyword': keyword, // 关键字
                'page': data.page, // 当前第几页
                'show': data.per_page // 每页多少
            }
        );
// 旅社列表
export const getTraveluser =
    (data, keyword) =>
        requestApi(
            '/Traveluser/user_lists',
            'POST',
            {
                'keyword': keyword, // 关键字
                'page': data.page, // 当前第几页
                'show': data.per_page // 每页多少
            }
        );
// 套餐列表
export const getTravelcase =
    (line_id) =>
        requestApi(
            '/Travelcase/case_lists',
            'POST',
            {
                'line_id': line_id // 线路ID
            }
        );
// 自定义套餐
export const getTravelcasecustom =
    () =>
        requestApi(
            '/Travelcase/case_custom',
            'POST',
            {}
        );
// 套餐详情
export const getTravelcasedetail =
    (case_id) =>
        requestApi(
            '/Travelcase/case_details',
            'POST',
            {
                'case_id': case_id // 套餐ID
            }
        );
// 景区列表
export const getTravelspot =
    (limit = '') =>
        requestApi(
            '/Travelspot/spot_lists',
            'POST',
            {
                'limit': limit // 个数
            }
        );
// 线路列表
export const getTravelline =
    (data, spot, is_good = '', is_hots = '') =>
        requestApi(
            '/Travelline/line_lists',
            'POST',
            {
                'page': data.page, // 当前第几页
                'show': data.per_page, // 每页多少
                'spot_id': spot, // 景区id
                'is_good': is_good, // 是否经典 1:是/2:否
                'is_hots': is_hots, // 是否推荐 1:是/2:否
            }
        )
// 线路详情
export const getTravellinedetail =
    (line_id) =>
        requestApi(
            '/Travelline/line_details',
            'POST',
            {
                'line_id': line_id, // 线路ID
            }
        )
// 酒店列表
export const getTravelhotel =
    (data, type, keyword) =>
        requestApi(
            '/Travelhotel/hotel_lists',
            'POST',
            {
                'page': data.page, // 当前第几页
                'show': data.per_page, // 每页多少
                'keyword': keyword, // 关键字
                'type': type // 酒店类型 1:民宿/2:酒店 默认1
            }
        );
// 首页经典
export const getTravelclassic =
    (limit = '') =>
        requestApi(
            '/Travelline/line_classic',
            'POST',
            {
                'limit': limit // 个数
            }
        );


// 提交行程
export const getTravelbuystep1 =
    (data) =>
        requestApi(
            '/Travelbuy/buy_step1',
            'POST',
            {
                ...data
            },
            'member'
        );

// 修改订单
export const getTravelupdateorder =
    (order_id,data) =>
        requestApi(
            '/Travelbuy/updateOrder',
            'POST',
            {
                order_id,
                ...data
            },
            'member'
        );
// 获取报价

export const getTravelbuystep2 =
    (data) =>
        requestApi(
            '/Travelbuy/buy_step2',
            'POST',
            {
                ...data
            },
            'member'
        );
//第三方支付
export const getTravelbuypay =
    (pay_sn, pd_pay, password) =>
        requestApi(
            '/Travelbuy/pay',
            'POST',
            {
                pay_sn,
                pd_pay,
                password
            },
            'member'
        );
//实物订单支付
export const getTravelbuygopay =
    (pay_sn, payment_code, key) =>
        requestRaw(
            env.SITE_URL + '?s=api/Travelbuy/go_pay/pay_sn/' + pay_sn + '/payment_code/' + payment_code + '/key/' + key
        );


//订单列表
export const getTravelorderlist =
    (data, state) =>
        requestApi(
            '/Travelorder/order_lists',
            'POST',
            {
                'state': state, // 订单状态 1:待报价/2:待付款/3:已取消/4:已付款/5:已完成
                'page': data.page, // 当前第几页
                'show': data.per_page // 每页多少
            },
            'member'
        );
//订单修改
export const getTravelorderedit =
    (order_id, name, mobile, remark) =>
        requestApi(
            '/Travelorder/order_edit',
            'POST',
            {
                order_id,// 订单ID
                name, // 联系人名
                mobile, //联系电话
                remark //备注信息
            },
            'member'
        );
//订单取消
export const getTravelordercancle =
    (order_id) =>
        requestApi(
            '/Travelorder/order_cancel',
            'POST',
            {
                order_id,// 订单ID
            },
            'member'
        );
//订单完成
export const getTravelordercomplete =
    (order_id) =>
        requestApi(
            '/Travelorder/order_complete',
            'POST',
            {
                order_id,// 订单ID
            },
            'member'
        );
//订单详情
export const getTravelorderdetail =
    (order_id) =>
        requestApi(
            '/Travelorder/order_details',
            'POST',
            {
                order_id,// 订单ID
            },
            'member'
        );



